package com.exercises;


class Exercise154 {
    public static void main(String[] args) {
        System.out.println(findMin(new int[]{1, 10, 1}));
    }


    public static int findMin(int[] nums) {


        int left = 0, right = nums.length - 1;
        while (left < right) {
            int cursor = (left + right) / 2;
            if (nums[cursor] == nums[right]) {
                right--;
            } else if (nums[cursor] < nums[right]) {
                right = cursor;
            } else {
                left = cursor + 1;
            }
        }

        return nums[right];
    }
}
